package com.gy.spark.core.actions

import org.apache.spark.{SparkConf, SparkContext}

object Operator_countByKey {

  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName(this.getClass.getSimpleName).setMaster("local")
    val sc = new SparkContext(conf)

    val rdd = sc.makeRDD(List(
      ("a", 111),
      ("b", 222),
      ("c", 333),
      ("d", 444)
    ))
    val count = rdd.countByKey()
    println(count)


    sc.stop
  }

}
